// Limitation.h: interface for the CLimitation class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LIMITATION_H__ED00DF04_8B74_4FE1_81D6_B00189174E8C__INCLUDED_)
#define AFX_LIMITATION_H__ED00DF04_8B74_4FE1_81D6_B00189174E8C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "LimitationV.h"

#include <map>

class CLimitation
	: public CLimitationV
{
// Interface
public:
	bool SetDeadline(const COleDateTime& dtDeadline);
	const COleDateTime* const GetDeadline() const;
	bool SetLimitedTimes(const UINT& nTimes);
	const UINT GetLeftTimes() const;
	virtual void Remove();

	UINT GetID();

	virtual bool IsPastDue();
	virtual void HandlePassAuthentication();

// Construction/Destruction
public:
	CLimitation(const UINT nLimitationID =0);
	virtual ~CLimitation();

// Data
protected:
	enum ELimitationType
	{
		Limitation_Time,
		Limitation_Times
	};
	typedef std::map<ELimitationType, CLimitationV*> MapLimitations;
	MapLimitations m_mapLimitations;

// Implement
protected:
	virtual void OnNew(CADORecordset* pRS);
	inline virtual void Load();
	virtual void MakeInValid();
private:
	static const CString KLimitation;
	static const CString IfTimeLimited;
	static const CString IfTimesLimited;
	void UpdateLimitationItem(const CString& strItemName, const bool& ifSet);
};

#endif // !defined(AFX_LIMITATION_H__ED00DF04_8B74_4FE1_81D6_B00189174E8C__INCLUDED_)
